<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>hello</h1>

</body>
<script>
    const socket = new WebSocket('ws://localhost:8080/chat');

    socket.onopen = function () {
        console.log('Connected to the chat server!');
        socket.send("hello  hello 快说话");
    };

    socket.onmessage = function (event) {
        console.log('Received message from the chat server:', event.data);
    };

    socket.onclose = function () {
        console.log('Disconnected from the chat server!');
    };


</script>

</html>